function CheckMate_Data(data) {
	var buffer = new StringBuffer();
	buffer.append('<div class="selectbar"><div id="userbar" class="bar select">同事</div><div id="departbar" class="bar">部门</div></div>');
	buffer.append('<div class="barline border-bottom"></div>');
	buffer.append('<div id="userlist" class="userlist">');
		buffer.append('<div class="loading"><img src="img/loading.gif"/></div>');
	buffer.append('</div>');
	buffer.append('<div id="departlist" class="userlist hidden">');
		
	buffer.append('</div>');
	return buffer.toString();
};

function Bind_CheckMate(userlist,departlist)
{
	touserid=obj10.attr("touserid");
	todepartid=obj10.attr("todepartid");
	tocomid=obj10.attr("tocomid");
	var buffer = new StringBuffer();
	$(userlist).each(function(i,info){
		buffer.append('<div class="ulist mui-checkbox border-bottom"><label><div class="headimg"><img src="'+info.HeadImg+'"/></div><div class="realname">'+info.RealName+'</div></label><div class="checkbox"><input flag="2" name="checkbox1" value="'+info.ID+'" val="'+info.RealName+'" type="checkbox" '+((","+touserid+",").indexOf(","+info.ID+",")>-1?"checked":"")+'></div></div>');
	});
	$("#userlist").html(buffer.toString());
	
	buffer = new StringBuffer();
	buffer.append('<div class="ulist mui-checkbox border-bottom allcompany"><label><div class="realname">全公司</div></label><div class="checkbox"><input flag="0" name="checkbox1" value="'+comid+'" val="全公司" type="checkbox" '+(tocomid!=""?"checked":"")+'></div></div>');
	$(departlist).each(function(i,info){
		buffer.append('<div class="ulist mui-checkbox border-bottom onlydepart"><label><div class="realname">'+info.big.Name+'</div></label><div class="checkbox"><input flag="1" name="checkbox1" value="'+info.big.ID+'" val="'+info.big.Name+'" type="checkbox" '+((","+todepartid+",").indexOf(","+info.big.ID+",")>-1?"checked":"")+'></div></div>');
		$(info.small).each(function(i,small){
			buffer.append('<div class="ulist mui-checkbox border-bottom onlydepart"><label><div class="realname">'+small.Name+'</div></label><div class="checkbox"><input flag="1" name="checkbox1" value="'+small.ID+'" val="'+small.Name+'" type="checkbox" '+((","+todepartid+",").indexOf(","+small.ID+",")>-1?"checked":"")+'></div></div>');
		});
	});
	$("#departlist").html(buffer.toString());
};

function Init_CheckMate()
{
	mui(".selectbar").on("tap",".bar",function() {
		
		$(".selectbar .bar").removeClass("select");
		$(this).addClass("select");
		if($(this).html()=="同事")
		{
			$("#userlist").show();
			$("#departlist").hide();
		}else
		{
			$("#userlist").hide();
			$("#departlist").show();	
		}
	});
};


